/**
 * 数据处理的基类
 */
let require = () => {
    throw new Error('The constructor must pass arguments');
};

export class BaseModel {
    constructor(that = require()) {
        this.that = that;
    }

    /**
     * 统一处理异常的基类
     * @param data 异常数据
     * @param errorBack
     */
    errorDispose(data, errorBack) {
        switch (data.status) {
            /*case -119:
                //没有登录，跳转到权限验证登录页面
                this.that.$router.push('/');
                errorBack(data);
                break;
            case -1:
                this.that.$message({
                    showClose: true,
                    duration: 2000,
                    message: data.msg,
                    type: 'error'
                });
                errorBack(data);
                break;
            case -120:
                this.that.$message({
                    showClose: true,
                    duration: 0,
                    message: data.msg,
                    type: 'error'
                });
                break;*/
            default:
                errorBack(data);
                console.log("错误内容输出：", data);
                break;
        }
    }
}
